//
//  ChatTableViewController.m
//  9-20
//
//  Created by mac on 16/9/28.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ChatTableViewController.h"
#import "Chat.h"
#import "TableViewCell.h"
#import "TableViewController.h"
@interface ChatTableViewController ()
{
    NSArray *name;
    NSArray *news;
}
@end

@implementation ChatTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    Chat *chat = [[Chat alloc] init];
    name = [NSArray arrayWithArray:chat.name];
    news = [NSArray arrayWithArray:chat.news];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return name.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"boss" forIndexPath:indexPath];
    cell.label1.text = name[indexPath.row];
    cell.label2.text = news[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    TableViewController *viewcont = [self.storyboard instantiateViewControllerWithIdentifier:@"tabelviewcont"];
    viewcont.name = name[indexPath.row];
    viewcont.news = news[indexPath.row];
    [self.navigationController pushViewController:viewcont animated:YES];
}
@end
